home *** CD-ROM | disk | FTP | other *** search
/ PC for Alla 2005 May / PC för Alla 0505.iso / fullversioner / realsoft3d / data1.cab / Scripting / scripting / Intro / multipacker.js < prev    next >
Encoding:
Text File  |  2005-04-04  |  1.5 KB  |  51 lines

  1. // include javascript classes 
  2. include("oops/r3button.js"); 
  3. include("oops/r3window.js"); 
  4. include("oops/r3packer.js"); 
  5.  
  6. // callback for the buttons 
  7. function myhook(window, event, value) 
  8.     R3Exit(); // exit app. 
  9.     return 1; 
  10.  
  11. // create a window 
  12. window = new r3Window(R3WGA_Parent, _r3gui, 
  13.                 R3WGA_Left, 200, 
  14.               R3WGA_Top, 100, 
  15.               R3WA_Title, "Packer Hierarchy", 
  16.               R3WA_ReportCloseWindow, TRUE, 
  17.               R3WA_ReportNewSize, TRUE); 
  18.  
  19. // create the top level packer and attach it to the window 
  20. packer = new r3Packer(R3PA_Orientation, R3PAOF_VERTICAL); 
  21. window.SetGmanager(packer); 
  22.  
  23. // create two sub packers
  24. row1 = new r3Packer(R3PA_Orientation, R3PAOF_HORIZONTAL); 
  25. packer.ADD(R3PAPF_FILLX, 0, row1);
  26. row2 = new r3Packer(R3PA_Orientation, R3PAOF_HORIZONTAL); 
  27. packer.ADD(R3PAPF_FILLX, 0, row2);
  28.  
  29.  
  30. // create bunch of buttons and insert them into the row1
  31. for(i = 0; i < 5; i++) { 
  32.     button = new r3Button(R3RA_Hook, myhook, // specify hook function
  33.               R3WGA_Parent, window,  
  34.               R3GA_Text, "Exit " + i); 
  35.     row1.ADD(R3PAPF_EXPAND | R3PAPF_FILLX | R3PAPF_FILLY, 0, button); 
  36.  
  37. // create bunch of buttons and insert them into the row1
  38. for(i = 0; i < 5; i++) { 
  39.     button = new r3Button(R3WGA_Parent, window,  
  40.               R3GA_Text, "2nd row " + i); 
  41.     row2.ADD(R3PAPF_EXPAND | R3PAPF_FILLX | R3PAPF_FILLY, 0, button); 
  42.  
  43.  
  44. // calculate best layout for the window and make it all visible 
  45. window.FIT(R3WFP_BESTFIT); 
  46. window.REALIZE();
  47.